React Native - Native Android
This page describes how to setup the Grouplink SDK on the native Android folders of a React-Native project.
React Native - Android
1 - Required Permissions
First, you need to add the required permissions to your Android manifest file (you can find this file inside the android/app/src folder). You can follow the Required Permissions on Android guide to learn more.
2 - Starting BLE and Location Service on Android
Create an asynchronous function and add the methods startLocationAndroid() and startBluetoothAndroid().
export default function App() {
useEffect(() => {
// ...
requestAndroidPermissions();
}, []);
async function requestAndroidPermissions() {
await GroupLinkSDK.startLocationAndroid();
await GroupLinkSDK.startBluetoothAndroid();
}
return (
<View style={styles.container}>
<Text>This is a test application</Text>
</View>
);
}
3 - Full Screen Intent and Schedule Exact Alarm Permissions
export default function App() {
useEffect(() => {
// ...
GroupLinkSDK.requestFullIntentPermissionAndroid();
GroupLinkSDK.requestScheduleExactAlarmPermissionAndroid();
}, []);
return (
<View style={styles.container}>
<Text>This is a test application</Text>
</View>
);
}